/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.util.ArrayList;
import javax.swing.AbstractListModel;


/**
 *
 * @author Administrator
 */
public class MListModel<T> extends AbstractListModel<Object>{

    ArrayList<T> list;
    public MListModel() {
        super();
        list = new ArrayList<T>();
    }

    public MListModel(ArrayList<T> list) {
        super();
        this.list = list;
    }
    public void addObject(T item)
    {
        list.add(item);
        fireContentsChanged(this, 0, list.size());
    }
    
    @Override
    public int getSize() {
        return list.size();
    }

    @Override
    public Object getElementAt(int index) {
        return list.get(index).toString();
    }

    public T getObject(int index){
        return list.get(index);
    }
    
}
    
